<template>
    <div class="reportFormPage" v-if="show">
        <div class="report-dom">
            <el-row>
                <el-col :span="5" :offset="19">
                    <div class="pageNumBox">
                        <span>第</span>
                        <span class="placeholder-min text-center">&nbsp;{{ form.page }}&nbsp;</span>
                        <span>页，共</span>
                        <span class="placeholder-min text-center">&nbsp;{{ form.totalPage }}&nbsp;</span>
                        <span>页</span>
                    </div>
                </el-col>
            </el-row>
            <div class="topTwoBox">
                <div class="centerName">{{ this.form.baobmc }}</div>
                <div class="codeText">
                    <tr v-for="(item, index) in form.baobbhList">{{ item }}</tr>
                </div>
            </div>
            <div class="threeTopBox">
                <div class="left-border">
                    <div class="box-title">检测单位名称：</div>
                    <div class>{{ form.jiancdwmc }}</div>
                </div>
                <div class="right-border">
                    <span>报告编号：</span>
                    <span class="placeholder">{{ form.baogbh }}</span>
                </div>
            </div>
            <!-- .........................1111111111111111111111111111111......................................................... -->
            <div class="table-border">
                <table height="220px" class="top-table">
                    <tbody>
                    <tr>
                        <td height="30" align="center" width="15%">
                            <span style="width: 90px; display: inline-block">工程名称</span>
                        </td>
                        <td width="35%" class="text-center">
                            <span>{{ form.gongcmc }}</span>
                        </td>
                        <td align="center" width="15%">
                            <span style="width: 90px; display: inline-block">工程部位/用途</span>
                        </td>
                        <td width="35%" class="text-center">
                            <span>{{ form.gongcbwyt }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="50" align="center">样品信息</td>
                        <td class="specimen-border" colspan="3">
                            <span>样品名称：</span>
                            <span :class="{ 'placeholder': !form.yangpmc }">{{ form.yangpmc }}</span>
                            <span>；样品编号：</span>
                            <span :class="{ 'placeholder-long': !form.yangpbh }">{{ form.yangpbh }}</span>

                            <span>；样品数量：</span>
                            <span :class="{ 'placeholder': !form.yangpsl }">{{ form.yangpsl }}</span>
                            <span>；样品状态：</span>
                            <span :class="{ 'placeholder': !form.yangpzt }">{{ form.yangpzt }}</span>
                            <span>；来样时间：</span>
                            <span :class="{ 'placeholder': !form.yangpsj }">{{ form.yangpsj }}</span>
                        </td>
                    </tr>
                    <tr>
                        <td height="25" align="center" width="15%">
                            <span style="width:90px;display:inline-block">试验检测日期</span>
                        </td>
                         <!-- <td width="35%" class="text-center">{{ form.shiyjcrq }}</td> -->                                            
 <td width="35%" class="text-center">
      <el-input v-model="form.shiyjcrq" />
</td>
                        <td align="center" width="15%">
                            <span style="width:90px;display:inline-block">试验条件</span>
                        </td>
                        <td v-if="isPdf" width="35%">
                            温度：
                            <span style="display: inline-block; width: 10%;">{{ form.shiytjwd }}</span>
                            ℃；湿度：
                            <span style="display: inline-block; width: 10%;">{{ form.shiytjsd }}</span>%RH
                        </td>
                        <td v-else width="35%">
                            温度：
                            <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjwd" class="height100"
                                      style="width: 15%"/>
                            ℃；湿度：
                            <el-input :type="isPdf ? 'string' : 'number'" v-model="form.shiytjsd" class="height100"
                                      style="width: 15%"/>
                            %RH
                        </td>
                    </tr>
                    <tr>
                        <td height="40" align="center" width="15%">
                            <span style="width: 90px; display: inline-block">检测依据</span>
                        </td>
                        <td width="35%">
                            <span v-if="isPdf">{{ form.jiancyj }}</span>
                            <el-input v-else type="textarea" v-model="form.jiancyj" :rows="2" class="mark"
                                      @dblclick.native="showBsJiancyjView" readonly/>
                        </td>
                        <td align="center" width="15%">
                            <span style="width: 90px; display: inline-block">判定依据</span>
                        </td>
                        <td width="35%">
                            <span v-if="isPdf">{{ form.pandyj }}</span>
                            <el-input v-else type="textarea" v-model="form.pandyj" :rows="2"
                                      @dblclick.native="showBsJudgeBaseView"
                                      @focus="handleFocus('pandyj')" class="mark"/>
                        </td>
                    </tr>
                    <tr class="bottom-border">
                        <td height="50" align="center">
                            <div>主要仪器设备</div>
                            <div>名称及编号</div>
                        </td>
                        <td colspan="3">
                            <span v-if="isPdf">{{ form.zhuyyqsbmcjbh }}</span>
                            <el-input v-else type="textarea" :rows="2" v-model="form.zhuyyqsbmcjbh"
                                      class="height100 width100 mark"
                                      @dblclick.native="showBsInstrumentView" readonly></el-input>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- .................................22222222222222222222222222222222............................................... -->
                <table height="610px" class="middle-table">
                    <tbody>
                    <tr>
                        <td colspan="1" width="15%">取样地点</td>
                        <td colspan="5">
                            <el-input tabindex="200" v-model="form.quydd"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" width="15%">代表数量</td>
                        <td colspan="2" width="30%">
                            <el-input tabindex="200" v-model="form.daibsl"/>
                        </td>
                        <td colspan="1" width="15%">批号</td>
                        <td colspan="2">
                            <el-input tabindex="200" v-model="form.pih"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="1" width="15%">出厂日期</td>
                        <td colspan="2" width="30%">
                            <el-input tabindex="200" v-model="form.chucrq"/>
                        </td>
                        <td colspan="1" width="15%">生产厂家</td>
                        <td colspan="2">
                            <el-input tabindex="200" v-model="form.shengccj"/>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">试验项目</td>
                        <td colspan="1">技术指标</td>
                        <td colspan="1">检测结果</td>
                        <td colspan="1">结果绑定</td>
                    </tr>
                    <tr>
                        <td>1</td>
                        <td colspan="2">针入度25℃(0.1mm)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[119].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('119')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[119].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[119].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>2</td>
                        <td colspan="2">针入度指数(PI)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[127].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('127')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[127].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[127].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>3</td>
                        <td colspan="2">延度-℃(cm)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[133].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('133')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[133].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[133].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>4</td>
                        <td colspan="2">软化点(℃)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[122].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('122')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[122].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[122].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>5</td>
                        <td colspan="2">闪点(℃)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[123].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('123')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[123].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[123].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>6</td>
                        <td colspan="2">黏韧性(N.m)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[134].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('134')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[134].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[134].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>7</td>
                        <td colspan="2">韧性(N.m)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[135].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('135')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[135].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[135].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>8</td>
                        <td colspan="1" rowspan="3" width="8%">沥青薄膜(旋转薄膜)加热试验</td>
                        <td colspan="1">质量变化(%)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[124].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('124')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[124].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[124].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>9</td>
                        <td colspan="1">残留针入度比 {{form.canlzrdbWendu||'-'}}℃(%)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[136].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('136')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[136].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[136].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>10</td>
                        <td colspan="1">残留延度 {{form.canlydWendu || '-'}}℃(%)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[137].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('137')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[137].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[137].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>11</td>
                        <td colspan="2">密度(g/cm³)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[128].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('128')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[128].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[128].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>12</td>
                        <td colspan="2">运动黏度135℃(Pa.S)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[138].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('138')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[138].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[138].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>13</td>
                        <td colspan="2">弹性恢复25℃(%)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[139].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('139')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[139].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[139].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>14</td>
                        <td colspan="2">溶解度(%)</td>
                        <td>
                            <el-input v-model="form.baDetailVos[132].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('132')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[132].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[132].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    <tr>
                        <td>15</td>
                        <td colspan="2">贮存稳定性离析,48h软化点差</td>
                        <td>
                            <el-input v-model="form.baDetailVos[140].jiszb" class="mark"
                                      @dblclick.native="showBsJudgeBaseEditView('140')" readonly/>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[140].jiancjg || '' }}</div>
                        </td>
                        <td>
                            <div>{{ form.baDetailVos[140].jiegpd || '' }}</div>
                        </td>
                    </tr>
                    </tbody>
                </table>
                <!-- .....................................................33333333333333333................................................... -->
                <table height="100px" class="bottom-table">
                    <tr>
                        <td style="border-bottom-width: 1px;">
                            <span v-if="isPdf" class="textarea-span">{{ form.jiancjl }}</span>
                            <el-input v-else type="textarea" :rows="2" v-model="form.jiancjl"
                                      @focus="handleFocus('jiancjl')"
                                      @dblclick.native="getJcjl()"/>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span v-if="isPdf" class="textarea-span">{{ form.fujsm }}</span>
                            <el-input v-else type="textarea" :rows="2" v-model="form.fujsm"
                                      @focus="handleFocus('fujsm')"/>
                        </td>
                    </tr>
                </table>
            </div>
            <!-- .................................44444444444............................................. -->
            <table height="22px" class="transparent">
                <tbody>
                <tr>
                    <td width="10%" align="right">检测：</td>
                    <td width="15%" align="left">
                        <!-- {{this.form.jiancr}} -->
                    </td>
                    <td width="10%" align="right">审核：</td>
                    <td width="15%" align="left">
                        <!-- {{this.form.jilr}} -->
                    </td>
                    <td width="10%" align="right">批准：</td>
                    <td align="left" width="15%">
                        <!-- {{this.form.fuhr}} -->
                    </td>
                    <td width="10%">日期：</td>
                    <td align="left" width="15%">
                        <div style="display: inline-block; margin-right: 30px;">年</div>
                        <div style="display: inline-block; margin-right: 30px;">月</div>
                        <div style="display: inline-block;">日</div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <bs-instrument-view ref="bsInstrumentViewRef" @select="selectInstrument"></bs-instrument-view>
        <bs-jiancyj-view ref="bsJiancyjViewRef" @select="selectJiancyj" :syType="syType"></bs-jiancyj-view>
        <bs-judge-base-view ref="bsJudgeBaseViewRef" @select="selectJudge" :syType="syType"></bs-judge-base-view>
        <bs-judge-base-edit-view ref="bsJudgeBaseEditViewRef" @submit="selectJudgeBaseEdit"
                                 :syType="syType"></bs-judge-base-edit-view>
    </div>
</template>

<script>
import decimal from "@/utils/big-decimal";
import Bus from "@/utils/bus";
import {handleFocus, emptyConvert, uniqueStr} from "@/views/reportForms/utils";
import {getLqnGxlqbgBsInfo} from "@/api/report_lqn/lqn";
import BaQjDetailView from "@/views/sycs/baQjDetail/BaQjDetailView.vue";
import {computeBiQualification} from "@/api/sycs/biQualification";
import BsInstrumentView from "@/views/dept/bsInstrument/BsInstrumentView.vue";
import BsJiancyjView from "@/views/sycs/bsJiancyj/BsJiancyjView.vue";
import BsJudgeBaseView from "@/views/sycs/bsJudgeBase/BsJudgeBaseView.vue";
import BsJudgeBaseEditView from "@/views/sycs/bsJudgeBase/BsJudgeBaseEditView.vue";

export default {
    name: "gxlqbg",
    components: {
        BaQjDetailView,
        BsInstrumentView,
        BsJiancyjView,
        BsJudgeBaseView,
        BsJudgeBaseEditView
    },
    props: {
        excelId: {
            type: [String, Number],
            default: () => ""
        },
        syType: {
            type: [String, Number],
            default: () => ""
        },
        page: {
            type: Number,
            default: () => 0
        },
        isPdf: {
            type: Boolean,
            default: () => false
        },
        printEmpty: {
            type: Boolean,
            default: () => false
        }
    },
    data() {
        return {
            form: {
                detailList: [],
                baobbhList: []
            },
            show: false,
            baDetailVos: {
                119: {},
                127: {},
                133: {},
                122: {},
                123: {},
                134: {},
                135: {},
                124: {},
                136: {},
                137: {},
                128: {},
                138: {},
                139: {},
                132: {},
                140: {},
            },
        };
    },
    watch: {
        isPdf(newVal, oldVal) {
            this.form = {...emptyConvert(this.form, newVal)};
        }
    },
    created() {
        this.init();
    },
    mounted() {
// 检测依据
        Bus.$on("setKfBgJiancyj", (data) => {
            const {jiancyj, jiancyjIds} = data;
            const str = jiancyj + (this.form.jiancyj ? "、" + this.form.jiancyj : "");
            const ids = jiancyjIds + (this.form.jiancyjIds ? "," + this.form.jiancyjIds : "");
            this.form.jiancyj = uniqueStr(str, "、");
            this.form.jiancyjIds = uniqueStr(ids, ",");
        });
        // 主要设备
        Bus.$on("setKfBgZhuyyqsbmcjbh", (data) => {
            const {zhuyyqsbmcjbh, shebIds} = data;
            const str = zhuyyqsbmcjbh + (this.form.zhuyyqsbmcjbh ? "、" + this.form.zhuyyqsbmcjbh : "");
            const ids = shebIds + (this.form.shebIds ? "," + this.form.shebIds : "");
            this.form.zhuyyqsbmcjbh = uniqueStr(str, "、");
            this.form.shebIds = uniqueStr(ids, ",");
        });
        // 各报表给报告传值
        Bus.$on("setLqnBgJiancjg", (data) => {
            if (data.length <= 0) {
                return;
            }
            let count = 0;
            data.forEach((item) => {
                if (!this.form.baDetailVos[item.key] || !this.form.baDetailVos[item.key].qualId) {
                    return;
                }
                // console.log(this.form.baDetailVos[item.key].jiancjg, item.value);
                if (this.form.baDetailVos[item.key].jiancjg == item.value) {
                    count++;
                }
            });

            if (count == data.length) {
                return;
            }
            let keys = [];
            let flg = false;
            data.forEach((item) => {
                if (!this.form.baDetailVos[item.key] || !this.form.baDetailVos[item.key].qualId) {
                    return;
                }
                this.form.baDetailVos[item.key].jiancjg = item.value;
                if (!flg && this.form.baDetailVos[item.key].symbolValue) {
                    flg = true;
                } else {
                    this.form.baDetailVos[item.key].jiegpd = "实测值";
                }
                keys.push(item.key);
            });
            if (flg) {
                this.computeDetectionResult(keys);
            }
        });

        // 沥青密度试验检测记录表-平均密度传值
        Bus.$on("setLqJCBgPjMd", (data) => {
            this.$set(this.form.baDetailVos[128], 'jiancjg', data.md)
        });

        // 沥青薄膜加热/旋转薄膜试验检测记录表-质量损失/质量变化
        Bus.$on("setLqJCBgZlss", (data) => {
            this.$set(this.form.baDetailVos[124],'jiancjg',data.zlss)
        });
        // 沥青薄膜加热/旋转薄膜试验检测记录表-残留针入度相传值
        Bus.$on("setLqJCBgClzrdb", (data) => {
            this.$set(this.form,'canlzrdbWendu',data.wd)
            this.$set(this.form.baDetailVos[136],'jiancjg',data.clzrd)
        });
        // 沥青薄膜加热/旋转薄膜试验检测记录表-残留延度相关数据
        Bus.$on("setLqJCBgClyd", (data) => {
            this.$set(this.form,'canlydWendu',data.wd1)
            this.$set(this.form.baDetailVos[137],'jiancjg',data.clyd1)
        });
    },
    beforeDestroy() {
        // 停止监听事件
    },
    methods: {
        // 根据报表id获取当前报表信息
        init() {
            this.show = false;
            getLqnGxlqbgBsInfo(this.excelId || this.$defaultExcelId).then((response) => {
                this.form = response.data;
                this.setInitialValue();
                if (!this.form.detailList || this.form.detailList.length <= 0) {
                    this.getDetailList();
                }
                this.show = true;
                if (!this.form.jiancjl) {
                    this.form.jiancjl = "检测结论：";
                }
                if (!this.form.fujsm) {
                    this.form.fujsm = "附加声明：";
                }
            });
        },
        // 设置初始值
        setInitialValue() {
            if (this.form) {
                this.form.baobmc = this.form.baobmc || "改性沥青试验检测报告";
                this.form.baobbh = this.form.baobbh || "BGLQ10004F";
                this.$set(this.form, "baobbhList", []);
                this.form.baobbhList = ["BGLQ10004F"];
            }
        },
        getDetailList() {
            this.$set(this.form, "detailList", []);
        },
        // 显示检测依据列表
        showBsJiancyjView() {
            this.$refs.bsJiancyjViewRef.init(this.form.jiancyjIds);
        },
        // 检测依据选择
        selectJiancyj(info) {
            this.form.jiancyj = info.label;
            this.form.jiancyjIds = info.ids;
            Bus.$emit("setGjbhcBgJiancyj", {jiancyj: this.form.jiancyj, jiancyjIds: this.form.jiancyjIds});
        },
        // 显示判定依据列表
        showBsJudgeBaseView() {
            this.$refs.bsJudgeBaseViewRef.init(this.form.pandyjIds);
        },
        // 判断依据选择
        selectJudge(info) {
            if (!info || !info.label) {
                return;
            }
            if (!this.form.pandyj) {
                this.form.pandyj = info.label;
            } else {
                if (info && info.label) {
                    this.form.pandyj += "、" + info.label;
                }
            }
            // 添加指标 info.list
            let keys = [];
            info.list.forEach((item) => {
               if (this.form.baDetailVos[item.refQualId] && this.form.baDetailVos[item.refQualId].jiancjg) {
                    this.form.baDetailVos[item.refQualId].symbolValue = item.symbolValue;
                    this.form.baDetailVos[item.refQualId].num1 = item.num1;
                    this.form.baDetailVos[item.refQualId].num2 = item.num2;
                    keys.push(item.refQualId);
                }
            });
            this.computeDetectionResult(keys);
        },
        // 显示仪器列表
        showBsInstrumentView() {
            this.$refs.bsInstrumentViewRef.init(this.form.shebIds);
        },
        // 仪器选择
        selectInstrument(info) {
            this.form.zhuyyqsbmcjbh = info.label;
            this.form.shebIds = info.ids;
            Bus.$emit("setGjbhcBgZhuyyqsbmcjbh", {zhuyyqsbmcjbh: this.form.zhuyyqsbmcjbh, shebIds: this.form.shebIds});
        },
        // 显示单个技术编辑
        showBsJudgeBaseEditView(key) {
            const info = this.form.baDetailVos[key];
            info.refQualId = info.qualId;
            this.$refs.bsJudgeBaseEditViewRef.init(info);
        },
        // 编辑单个技术指标后赋值
        selectJudgeBaseEdit(info) {
            if (info.qualId) {
                this.form.baDetailVos[info.qualId] = info;
            }
            this.computeDetectionResult([info.qualId]);
        },
        // 计算检测结果
        computeDetectionResult(keys) {
            if (!keys || keys.length <= 0) {
                return;
            }
            const data = keys.map((key) => {
                const info = {
                    ...this.form.baDetailVos[key],
                    jiancjg: this.form.baDetailVos[key].jiancjg == "-" ? "" : this.form.baDetailVos[key].jiancjg
                };
                return info;
            });
            computeBiQualification(data).then((res) => {
                const returnData = res.data;
                returnData.forEach((item) => {
                    item.jiancjg = item.jiancjg ? item.jiancjg : "-";
                    this.form.baDetailVos[item.qualId] = item;
                });
            });
        },
        // 计算合格率
        calculateHgl(index, type) {
            let hgl = null;
            let Scds = this.form.detailList[index][type + "Scds"];
            let Hgds = this.form.detailList[index][type + "Hgds"];
            if (Scds && Hgds) {
                hgl = decimal.divide(decimal.multiply(Hgds, 100), Scds);
            }
            this.form.detailList[index][type + "Hgl"] = hgl;

            if (!this.form.detailList[index][type + "Scds"]) {
                this.form.detailList[index][type + "Scds"] = null;
            }
            if (!this.form.detailList[index][type + "Hgds"]) {
                this.form.detailList[index][type + "Hgds"] = null;
            }
        },
        // 值为空设为null
        clearEmpty(index, type) {
            if (!this.form.detailList[index][type]) {
                this.form.detailList[index][type] = null;
            }
        },
        getJcjl() {
            let jcjl = '检测结论：经检测，';
            const arr = this.form.baDetailVos;
            Object.keys(arr).forEach(key => {
                if (arr[key].jiancjg && arr[key].jiancjg != '符合') {
                    jcjl = jcjl + (arr[key].qualName || '') + (arr[key].jiegpd || '') + '为' + (arr[key].jiancjg || '') + (arr[key].qualUnit || '') + '；';
                }
            });
            jcjl = jcjl + '所检指标均符合《公路沥青路面施工技术规范》JTGF40-2004及设计文件要求。';
            this.form.jiancjl = jcjl;
        },
        submitForm() {
            return this.form;
        },
        handleFocus(event) {
            handleFocus(event, this.page, this.form[event]);
        }
    }
};
</script>

<style scoped></style>
